package com.example.supermarket.controller;

import com.example.supermarket.pojo.Item;
import com.example.supermarket.pojo.Result;
import com.example.supermarket.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @GetMapping("/getItemListByItemId")
    public Result<List<Item>> getItemByItemId(@RequestParam List<Integer> itemIds){
        List<Item> list=itemService.getItemByItemId(itemIds);
        return Result.success(list);
    }

    @GetMapping("/getItemByBusinessId")
    public Result<List<Integer>> getItemByBusinessId(){
        List<Integer> list=itemService.getItemByBusinessId();
        return Result.success(list);
    }
}
